
var r_str=argument0;
    global.stat_ctrls=ds_list_create();
    tmp=jso_decode_list(r_str);
    var i=0,k=0;
   //show_message("decode list done");
   with (control_obj) {instance_destroy();}
   
      
    while (jso_list_check(tmp,i,"name"))
    {
    echo("going to do list lookup i = "+string(i));
      echo("loading "+jso_list_lookup(tmp,i,"name"));
    
    if (jso_list_lookup(tmp,i,"name")!="points")
    {
    if (real(jso_list_lookup(tmp,i,"glob"))<1)
    {
    inst=instance_create(0,0,control_obj);
    inst.orig_x=inst.w/2+10;
    inst.orig_y=(k+1.5)*(inst.h+10)+5;
        
    inst.ctrl_name=jso_list_lookup(tmp,i,"name");
    inst.label=jso_list_lookup(tmp,i,"label");
    inst.points=real(jso_list_lookup(tmp,i,"val"));
    inst.point_val=real(jso_list_lookup(tmp,i,"inf"));
    inst.base=real(jso_list_lookup(tmp,i,"base"));
    inst.tip=jso_list_lookup(tmp,i,"tip");
    inst.enabled=1;
    inst.ctrl_name=jso_list_lookup(tmp,i,"name");
    inst.increase_by=real(jso_list_lookup(tmp,i,"inc"));
    inst.max_pts=real(jso_list_lookup(tmp,i,"max"));
    ds_list_add(global.stat_ctrls,inst);
    k++
    }
    } else {
    if jso_list_lookup(tmp,i,"name")=="points"
    global.points=real(jso_list_lookup(tmp,i,"val"));
    
    }
    
    i++;
    }
calc_used_points();
    
stats_dock.cnt=ds_list_size(global.stat_ctrls)-1;


